
<template lang="jade">

div.return-bar
  i.iconfont(@click="back()") &#xe668;
  {{info.name}}

div.user-center.detail_top
  ul.payinfo
    li 借款金额：{{info.account}}
    li 还款方式：{{info.borrow_style}}
    li 借款利率：{{info.borrow_apr}}
    li 发布时间：{{info.verify_time}}
    li 借款期限：{{info.borrow_period}}
    li 借款时间：{{info.reverify_time}}
    li.red 手机版暂时不支持还款,谢谢合作!

  dl.invest_list(v-for="(index, item) in items")
    dd
      div.title 
        span.txt 期数：第{{item.repay_period}}期
        span.date 计划还款日：{{item.repay_time}}

      ul.moneylist.triple.clearfix
        li
          strong 总还款金额
          span {{item.repay_time}}
        li
          strong 应还利息
          span {{item.repay_interest}}
        li
          strong 应还本金
          span {{item.repay_capital}}
        li
          strong 实还日期
          span {{item.repay_yestime}}
        li
          strong 逾期天数
          span {{item.late_day}}
        li
</template>


<script>
import '../../assets/sass/user/index.scss'
import {c_user_loan_pay, c_user_loan_info} from '../../config/api'

export default{
  data(){
    return{
      borrow_nid:'',
      info:{},
      items:[]
    }
  },

  methods: {

    back(){
      window.history.back();
    },

    getInfo(){
      this.$http({url: c_user_loan_info+'&borrow_nid='+this.borrow_nid, method: 'GET'}).then(function (response) {
        this.info = response.data.data;
      });
    },

    fetch: function (next) {
      this.$http({url: c_user_loan_pay+'&borrow_nid='+this.borrow_nid, method: 'GET'}).then(function (response) {
        this.items = response.data.data.list;
        this.busy = false;
        next();
      });
    }
  },
  route:{
    activate( transition ){
      var that = this;
      this.borrow_nid = transition.to.params.loanID;
      this.fetch(function(){
        that.getInfo();
        transition.next();
      })
    }
  }
}

</script>
